/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gov.nist.ssd.swqb.core;

import com.hp.hpl.jena.rdf.model.RDFNode;

/**
 *
 * @author benjamin herbomez
 */
public class Statement {
    protected final RDFNode subject, predicate, object;

    public Statement(RDFNode subject, RDFNode predicate, RDFNode object) {
        this.subject = subject;
        this.predicate = predicate;
        this.object = object;
    }

    public RDFNode getObject() {
        return object;
    }

    public RDFNode getPredicate() {
        return predicate;
    }

    public RDFNode getSubject() {
        return subject;
    }

    @Override
    public String toString() {
        return "("+subject+","+predicate+","+object+")";
    }

    @Override
    public boolean equals(Object o) {
        if(this == o)
            return true;
        if(!(o instanceof Statement))
            return false;
        Statement stmt = (Statement)o;
        return  stmt.getSubject().equals(subject) &&
                stmt.getObject().equals(object) &&
                stmt.getPredicate().equals(predicate);
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 47 * hash + (this.subject != null ? this.subject.hashCode() : 0);
        hash = 47 * hash + (this.predicate != null ? this.predicate.hashCode() : 0);
        hash = 47 * hash + (this.object != null ? this.object.hashCode() : 0);
        return hash;
    }
    
    
}
